package com.nlscan.qdkit.ui.publico.component;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;

import razerdp.basepopup.BasePopupWindow;
import razerdp.util.animation.AnimationHelper;
import razerdp.util.animation.TranslationConfig;

/**
 * 页面底部弹窗选择器
 */
public abstract class BaseBottomPopupWindow extends BasePopupWindow {
    public BaseBottomPopupWindow(Context context) {
        super(context);

        setPopupGravity(Gravity.BOTTOM);
        setContentView(onCreateContentView());
    }

    public abstract View onCreateContentView();

    @Override
    protected Animation onCreateShowAnimation() {
        return AnimationHelper.asAnimation()
                .withTranslation(TranslationConfig.FROM_BOTTOM)
                .toShow();
    }

    @Override
    protected Animation onCreateDismissAnimation() {
        return AnimationHelper.asAnimation()
                .withTranslation(TranslationConfig.TO_BOTTOM)
                .toShow();
    }

    public void show() {
        showPopupWindow();
    }
}
